import bjsos
from gk_management_service import GKManagementService


def main():
    server_pub_key = "0446b74da517f8b4e2d795beb170298d13ea3b576639efdc0a16f80e771a16a597de7b99764be47d6a5e93825a852501c15ab6d6c979e57f5d2bc7b4a2c9c859eea0cfa6c99effe59cffd542a0070379fa96fda58fb80163e2ddd3157a9b791abd".decode('hex')
    static_priv_key = "c4687ad2c37cd34521d8ded1e6e95fcfae234308dda70aa52f9602b663b196fd04b23f58bfc04f40865b50e89aaf82f2".decode('hex')
    static_pub_key = "04e41886cc931a6cfeaabee9a6c322aaa44e40fae249c0b04613985bf18ce092c1056922293493fac594c3eecbbaa64a564b4472b8f09fe6af728338e01c5cbac9f30b4882fee4a7b2e9ae3f4035ef762e766241cc862742e303a07fd265209175".decode('hex')

    new_pub_key = "04e41886cc931a6cfeaabee9a6c322aaa44e40fae249c0b04613985bf18ce092c1056922293493fac594c3eecbbaa64a564b4472b8f09fe6af728338e01c5cbac9f30b4882fee4a7b2e9ae3f4035ef762e766241cc862742e303a07fd265209175".decode('hex')
    gk_mgmt = GKManagementService('localhost', 8888, 0, static_priv_key, static_pub_key, server_pub_key)

    res = gk_mgmt.upload_new_keypair(timeout=0, clnt_pub_key=new_pub_key, fallback_kpid=0)

    print res

main()